<html>
<head>
<title><?php echo "多图片上传";?></title>
	<script src="multifile_compressed.js"></script>
	</head>
<body>
<?php 
if(isset($_POST['acte']) && $_POST['acte']=='r'){
$filwj=(isset($_POST['lxs']) && $_POST['lxs']=='jdzt')?"jdzt_pic":"zcbz_pic";
echo "<div id=loading><img src=\"clocks.gif\">图片上传中...</div>";
$i=0;
if(!empty($_FILES['file_0']['name'])){
$rnd = mt_rand(10, 50);
$filename = date('YmdHis').$rnd;
$savename=$filename.strtolower(strstr($_FILES['file_0']['name'], '.'));
$s_pic= dirname(dirname(__FILE__))."/upload/tie/".$savename;
if($_FILES['file_0']['size']<1000000)
{
if(move_uploaded_file($_FILES['file_0']['tmp_name'],$s_pic))
   {$i++;
			$na.=$savename;
 	@unlink($_FILES['file_0']['name']);
   }
   }
 else {echo "图片太大";}  
}
if(!empty($_FILES['file_1']['name'])){
$rnd = mt_rand(10, 50);
$filename = date('YmdHis').$rnd;
$savename=$filename.strtolower(strstr($_FILES['file_1']['name'], '.'));
$s_pic= dirname(dirname(__FILE__))."/upload/tie/".$savename;
}


$str="<script>document.getElementById('loading').style.visibility='hidden';";
$str.="window.opener.document.getElementById('tb_pic').value = '$na';window.close();";
$str.="</script>".$i."张图片上传成功！";
echo $str;
}else{
?>
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method = "post">
	<!-- The file element -- NOTE: it has an ID -->
	<input id="my_file_element" type="file" name="file">
	<input type="submit" value="上传">
	<input type="hidden" name="acte" value="r">
	<input type="hidden" name="lxs" value="<?php echo $_GET['lxs'];?>">
</form>
Files:
<!-- This is where the output will appear -->
<div id="files_list" style="border: 1px solid #FF99FF; min-height:60px;"></div>
<script>
	<!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->
	var multi_selector = new MultiSelector( document.getElementById( 'files_list' ),8);
	<!-- Pass in the file element -->
	multi_selector.addElement( document.getElementById( 'my_file_element' ) );
</script>
<?php }?>
</body>
</html>